﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WsdShop.Model.ViewModels
{
    public class V_ActivityTeamMembers : Model.ActivityTeamMembers
    {
        /// <summary>
        ///  团状态  组团中 = 1,组团成功 = 2 , 组团失败=3
        /// </summary>
        public int TeamStatus { get; set; }

        /// <summary>
        /// 团结束时间  团CreateTime+ContinuedTime
        /// </summary>
        public DateTime EndTime { get { return ActivityTeamCreateTime.AddHours(ActivityTeamContinuedTime); } }



        /// <summary>
        /// 活动名称
        /// </summary>
        public string ActivityName { get; set; }


        /// <summary>
        /// 活动封面图
        /// </summary>
        public string CoverImg { get; set; }



        /// <summary>
        /// 团开始的时间
        /// </summary>
        public DateTime ActivityTeamCreateTime { get; set; }

        /// <summary>
        /// 团持续的时间
        /// </summary>
        public int ActivityTeamContinuedTime { get; set; }


        /// <summary>
        /// 团长是否必中
        /// </summary>
        public bool IsWinning { get; set; }

        /// <summary>
        /// 抽奖活动id
        /// </summary>
        public int LuckDrawID { get; set; }

        /// <summary>
        /// 状态（中文）
        /// </summary>
        public string StateText
        {
            get
            {
                var t = "";
                if (TeamStatus == 1)
                {
                    t = "拼团中";
                    if (DateTime.Now > EndTime)
                    {
                        t = "组团失败";
                    }
                }
                if (TeamStatus == 2)
                {
                    if (WinningStatus == 4)
                    {
                        t = "待抽奖";
                    }
                    if (WinningStatus == 3)
                    {
                        t = "已中奖";
                    }
                    if (WinningStatus == 2)
                    {
                        t = "未中奖";
                    }
                    if (WinningStatus == 1)
                    {
                        t = "已中奖";
                    }
                }
                if (TeamStatus == 3)
                {
                    t = "组团失败";
                }
                if (TeamStatus == 4)
                {
                    t = "已退款";
                }
                return t;
            }
        }

    }
}
